﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using Cronus.ViewModel;

namespace Cronus.View
{
    public class PresentationBase : INotifyPropertyChanged
    {
        public DataModel Data { get; private set; }

        public PresentationBase(DataModel dataModel)
        {
            Data = dataModel;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            var evt = PropertyChanged;
            if (null != evt)
                evt(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public class CronusViewBase<T> : UserControl where T : PresentationBase
    {
        public T Presentation
        {
            get { return (T)DataContext; }
            set { DataContext = value; }
        }
    }
}
